package com.itrencai.String;

import java.util.Scanner;

public class StringEqualsDemo {
    public static void main(String[] args) {
        String okname="itrencai";
        String okpassword="123456";
        //用户输入用户名密码
        Scanner sc=new Scanner(System.in);
        System.out.println("登录名称：");
        String name=sc.next();
        System.out.println("登录密码：");
        String password=sc.next();
        //判断是否相等
        if(okname.equals(name)&&okpassword.equals(password)){
            System.out.println("登录成功");
        }else{
            System.out.println("用户名或密码错误！");
        }

        //忽略大小写比较内容的API:一般用于比较验证码这样的业务
        String syscode="23AdFh";
        String code1="23aDfH";
        System.out.println(syscode.equals(code1));//false
        System.out.println(syscode.equalsIgnoreCase(code1));//true忽略大小写

    }
}
